package com.jk.controller;

import com.jk.po.CommentPO;
import com.jk.po.HotelPO;
import com.jk.service.CommentService;
import com.jk.service.HotelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 段卓帆
 * @date 2021/6/30 11:23
 * @return 评论
 */
@RestController
@RequestMapping("comment")
@Api("评论操作接口")
public class CommentController {


    //日志记录对象
    private static Logger logger = LoggerFactory.getLogger(TestController.class);
    @Autowired
    private CommentService commentService;

    /**
     * @author 段卓帆
     * @date 2021/6/30 14:50
     * @return 查看评论详情
     */
    @PostMapping("queryCommentById/{id}")
    @ApiOperation(value = "回显查看评论详情",produces ="id")
    public CommentPO queryCommentById(@PathVariable("id")@ApiParam("评论id")Integer id){
        CommentPO commentPO = new CommentPO();
        try {
            commentPO =  commentService.queryCommentById(id);
            logger.info("回显查看评论详情成功");
        } catch (Exception e){
            logger.error("回显查看评论详情失败:"+e.getMessage());
        }
        return commentPO;
    }





}
